clc;
clear;
target_frame=4;
sampling_rate=256;
sampling_counts =10; 
% 指定文件夹路径
positive_folder_path = './positive';
% 指定文件夹路径
negative_folder_path = './negative';
% 从外部文件加载文件权重
external_weights_file = './positive_file_weights.csv';
positive_mat_files = dir(fullfile(positive_folder_path, '*.mat'));
positive_data_matrices = cell(1, numel(positive_mat_files));
parfor file_index = 1:numel(positive_mat_files)
    file_path = fullfile(positive_folder_path, positive_mat_files(file_index).name);
    loaded_data = load(file_path);
    positive_data_matrices{file_index} = loaded_data.data;
end
negative_mat_files = dir(fullfile(negative_folder_path, '*.mat'));
negative_data_matrices = cell(1, numel(negative_mat_files));
parfor file_index = 1:numel(negative_mat_files)
    file_path = fullfile(negative_folder_path, negative_mat_files(file_index).name);
    loaded_data = load(file_path);
    negative_data_matrices{file_index} = loaded_data.data;
end
EEG_weight_sampling(positive_data_matrices,negative_data_matrices, ...
                     positive_folder_path,negative_folder_path,external_weights_file, ...
                      target_frame,sampling_rate,10000,sampling_counts)
EEG_weight_sampling(positive_data_matrices,negative_data_matrices, ...
                     positive_folder_path,negative_folder_path,external_weights_file, ...
                      target_frame,sampling_rate,15000,sampling_counts)
EEG_weight_sampling(positive_data_matrices,negative_data_matrices, ...
                     positive_folder_path,negative_folder_path,external_weights_file, ...
                      target_frame,sampling_rate,20000,sampling_counts)